{% extends "base.admin.html" %}
{% block headmeta %}
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
  function createEditor() {
      var oFCKeditor = new FCKeditor('editorHtml');
      oFCKeditor.BasePath = "/fckeditor/";
      oFCKeditor.Height = 328;
      oFCKeditor.ReplaceTextarea();
    }

    function initFunc(){
    	node = document.getElementById('editorHtml')
    	if(typeof(node) !== 'undefined' && node != null)
    	{
    		createEditor();  
        } 
    }
    (function($) {
    	
    	$(document).ready(function () {
    		initFunc();
    	});

    })(jQuery);
  </script>
{% endblock %}
{% block body %}
<div id="content" class="container">
<h1>{{title}}</h1>
	{% if result %}
		<div class="status">{{msg}}</div>
	{% else %}
		{% if status %}
		<div class="warn">{{msg}}</div>
		{% endif %}
	{% endif %}
	<div class="formcontainer">
		<form name="app" action="{{request.path}}" method="POST">
		<div class="inputcontainer">
			<div class="label">App Type:
			<select name="field_type" size=1>
			  <option value="android" {% ifequal type "android" %}selected="true" {% endifequal %}>Android
			  <option value="iphone" {% ifequal type "iphone" %}selected="true" {% endifequal %}>iPhone
			</select>
			</div>
		</div>
		<div class="inputcontainer">
			<div class="label">Name:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_name" id="inputname" size="80" {% if app and app.name %} value="{{app.name}}" readonly {% endif %}/>
		</div>
		{% ifequal type "android" %}
		<div class="inputcontainer">
			<div class="label">Package URI:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_package" id="inputname" size="80" {% if app and app.package %} value="{{app.package}}" {% endif %}/>
		</div>
		<div class="inputcontainer">
			<div class="label">Min Version:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_versionmin" id="inputname" size="80" {% if app and app.versionmin %} value="{{app.versionmin}}" {% endif %}/>
		</div>
		{% endifequal %}
		<div class="inputcontainer">
			<div class="label">Display Name:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_displayname" id="inputname" size="80" {% if app and app.displayname %} value="{{app.displayname}}" {% endif %}/>
		</div>
		<div class="inputcontainer">
			<div class="label">Icon:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_icon" id="inputname" size="80"{% if app and app.icon %} value="{{app.icon}}" {% endif %}/>
		</div>
		<div class="inputcontainer">
			<div class="label">Logo:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_logo" id="inputname" size="80"{% if app and app.logo %} value="{{app.logo}}" {% endif %}/>
		</div>
		<div class="inputcontainer">
			<div class="label">Price:</div>
		</div>
		<div class="inputcontainer">
			<input name="field_price" id="inputname" size="80" {% if app and app.price %} value="{{app.price}}" {% endif %}/>
		</div>
		<div class="inputcontainer">
			<div class="label">Description<span class="required">*</span>:</div>
		</div>
		<div class="inputcontainer">	
<textarea rows="30" cols="100" name="field_desc" id="editorHtml">
{% if app and app.desc %}{{app.desc}} {% endif %}
</textarea>
		</div>
		
		<div class="inputcontainer">
			<input type="submit" name="submit" value="Submit"/>
		</div>
		</form>
	</div>
</div>
{% endblock %}